package main

type BNodeTree struct {
	Data      int
	LeftNode  *BNodeTree
	RightNode *BNodeTree
}
type ListNode struct {
	Data int
	Next *ListNode
}

func main() {
	arrayToTree([]int{1, 2, 3, 4, 5, 6, 7})
}

func arrayToTree(arr []int) (bTree *BNodeTree) {
	bTree = new(BNodeTree)
	mid := len(arr) / 2
	bTree.Data = arr[mid]

	if mid > 0 {
		bTree.LeftNode = arrayToTree(arr[:mid])
		bTree.RightNode = arrayToTree(arr[mid+1:])
	} else {
		bTree.LeftNode = nil
		bTree.RightNode = nil
	}

	return
}

func ListToTree() {

}
